import type { SpuImageItem } from "./spuModel";

export interface SkuAttrValueItem {
  id?: number;
  valueId: number;
  valueName: string;
  attrId: number;
  attrName: string;
}

export type SkuAttrValueList = SkuAttrValueItem[];

export interface SkuSaleAttrValueItem {
  id?: number;
  saleAttrId: number;
  saleAttrName: string;
  saleAttrValueId: number;
  saleAttrValueName: string;
}

export type SkuSaleAttrValueList = SkuSaleAttrValueItem[];

export interface SkuImageItem extends SpuImageItem {
  isDefault: string;
}

export type SkuImageList = SkuImageItem[];

export interface CommonSku {
  skuName: string;
  price: number;
  weight: number;
  skuDesc: string;
  skuAttrValueList: Array<string | undefined>;
  skuSaleAttrValueList: Array<string | undefined>;
  skuImageList: SkuImageList;
  skuDefaultImg: string;
}

// Omit<CommonSku, "skuAttrValueList" | "skuSaleAttrValueList">
// 从CommonSku类型排除"skuAttrValueList"和"skuSaleAttrValueList"属性，其他属性组成一个新的类型并返回
export interface SkuItem
  extends Omit<CommonSku, "skuAttrValueList" | "skuSaleAttrValueList"> {
  category3Id: number;
  // createTime: string;
  id?: number;
  isSale?: number;
  spuId: number;
  skuAttrValueList: SkuAttrValueList;
  skuSaleAttrValueList: SkuSaleAttrValueList;
  // tmId: number;
}
